package liportest.third;

import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@Service
public class ThirdNextIdImpl implements ThirdNextId {

    @Override
    public long nextId() {
        return 0;
    }


    public long aa() {
        Long companyId = 1L;
        try {
            if (!Objects.equals(companyId, 1000000L)) {
                throw new Exception("房源被在租合同占用不能发布");
            }
            System.out.println("aaa");
        } catch (Exception e) {
            System.out.println("cuowu"+e);
        }
        System.out.println("jixu?");
        return 1;
    }


//    public static void main(String[] args) {
//        List<Integer> objects = new ArrayList<>();
//        if (Objects.nonNull(objects) && objects.size()>1){
//            System.out.println("1");
//        }
//        System.out.println("2");
//    }


    public static void main(String[] args) {
//        1的阶乘是1
//        2的阶乘是1*2
//        3的阶乘是1*2*3
//        4的阶乘是1*2*3*4

        int n = 3;
        int total = 1;
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            total = total * i;
            sum = total + sum;
        }
        System.out.println(sum);


    }
}